/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package skat.comparators;

import rlpw.lang.Factory.FactoryEntry;
import skat.Card;
import skat.games.Game;

/**
 *
 * @author weinpau
 */
@FactoryEntry(Game.SCHELL)
public class ComparatorSchell extends Comparator {

    @Override
    public int getSortIndex(Card k) {
        int c = k.suit();
        if (k.rank() != 3) {
            if (c > 0) {
                c--;
            } else {
                c += 3;
            }
        }
        if (k.rank() < 3) {
            return 7 * c + k.rank();
        } else if (k.rank() > 3) {
            return 7 * c + (k.rank() - 1);
        } else {
            return 28 + c;
        }

    }
}
